﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace CADSchool
{
    class CADAxilian
    {
        public bool EmptySpace(TextBox txtControl)
        {
            bool ret = true;

            if ((txtControl.Text == "") || (txtControl.Text == null))
            {
                txtControl.BackColor = Color.Red;
                ret = false;
            }
            else
            {
                txtControl.BackColor = Color.Empty;
            }
            return ret;
        }

        public void StartSpace(TextBox txtControl)
        {
            txtControl.BackColor = Color.LightCyan;
            if (txtControl.Text == "")
            {
                txtControl.Clear();
                txtControl.ForeColor = Color.Black;
            }
        }

        public bool EmptySpace(MaskedTextBox txtControl)
        {
            bool ret = true;

            if ((txtControl.Text == "________") || (txtControl.Text == null) || (txtControl.Text == ""))
            {
                txtControl.Mask = null;
                txtControl.BackColor = Color.Red;
                ret = false;
            }
            else
            {
                txtControl.BackColor = Color.Empty;
            }
            return ret;
        }

        public void StartSpace(MaskedTextBox txtControl)
        {
            txtControl.BackColor = Color.LightCyan;
            if (txtControl.Text == "")
            {
                txtControl.Clear();
                txtControl.Mask = "00/00/0000";
                txtControl.ForeColor = Color.Black;
            }
        }

        public bool EmptySpace(ComboBox txtControl)
        {
            bool ret = true;

            if (txtControl.SelectedItem == null)
            {
                txtControl.BackColor = Color.Red;
                ret = false;
            }
            else
            {
                txtControl.BackColor = Color.Empty;
            }
            return ret;
        }

        public void StartSpace(ComboBox txtControl)
        {
            txtControl.BackColor = Color.LightCyan;
            if (txtControl.Text == "")
            {
                txtControl.ForeColor = Color.Black;
            }
        }

        public void MessageWarning(bool vR1, bool vR2, bool vR3, Panel warning)
        {
            if ((vR1) && (vR2) && (vR3))
            {
                warning.Visible = false;
            }
            else
            {
                warning.Visible = true;
            }
        }
    }
}
